﻿using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using System.Windows.Forms;
using Traceability.Commont.Domains.AnimalsDomainFiles;
using Traceability.Commont.DTOs;

namespace Butcher.winform.EnterpriseForms.ShopFrom
{
    public partial class ShopAddFrom : Form
    {
        public ShopAddFrom()
        {
            InitializeComponent();
        }

        private void uiButton1_Click(object sender, EventArgs e)
        {
            Shopping shop=new Shopping();
            shop.ShoppingDesignationName = uiTextBox1.Text;
            shop.Unit = uiTextBox2.Text;
            shop.Tablereport = uiTextBox3.Text;
            shop.Sku = uiTextBox4.Text;
            string url = @"http://localhost:5229/api/Batch/createShop";
            HttpClient client = new HttpClient();
            var content = new StringContent(JsonSerializer.Serialize<Shopping>(shop));
            content.Headers.Remove("Content-Type");
            content.Headers.Add("Content-Type", "application/json");
            string result = client.PostAsync(url, content).Result.Content.ReadAsStringAsync().Result;
            JObject info = JObject.Parse(result);
        }
    }
}
